<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Lucene vs Elasticsearch：深度对比分析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 悬挂标点 */
        .hanging-punctuation {
            hanging-punctuation: first last;
        }
        
        /* 卡片悬停效果 */
        .card-hover {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
        
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        
        /* 渐变文字效果 */
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 自定义滚动条 */
        ::-webkit-scrollbar {
            width: 10px;
        }
        
        ::-webkit-scrollbar-track {
            background: #f1f1f1;
        }
        
        ::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 5px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: #555;
        }
        
        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
        
        /* 特性卡片样式 */
        .feature-card {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        /* 比较表格样式 */
        .comparison-table {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }
        
        /* Mermaid 图表样式 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero 区域 -->
    <section class="relative overflow-hidden">
        <div class="absolute inset-0 bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 opacity-90"></div>
        <div class="relative container mx-auto px-6 py-24 text-center">
            <h1 class="text-5xl md:text-7xl font-bold text-white mb-6 animate-fadeInUp">
                Lucene <span class="text-yellow-300">vs</span> Elasticsearch
            </h1>
            <p class="text-xl md:text-2xl text-white opacity-90 max-w-3xl mx-auto animate-fadeInUp" style="animation-delay: 0.2s;">
                深入探索两大搜索引擎技术的架构、性能与应用场景
            </p>
            <div class="mt-10 flex justify-center space-x-6 animate-fadeInUp" style="animation-delay: 0.4s;">
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3 text-white">
                    <i class="fas fa-search text-2xl"></i>
                    <span class="ml-2 font-semibold">全文搜索引擎</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3 text-white">
                    <i class="fas fa-server text-2xl"></i>
                    <span class="ml-2 font-semibold">分布式架构</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3 text-white">
                    <i class="fas fa-chart-line text-2xl"></i>
                    <span class="ml-2 font-semibold">实时分析</span>
                </div>
            </div>
        </div>
    </section>

    <!-- 引言部分 -->
    <section class="container mx-auto px-6 py-16">
        <div class="max-w-4xl mx-auto">
            <div class="bg-white rounded-2xl shadow-xl p-10 feature-card">
                <p class="text-lg leading-relaxed text-gray-700 drop-cap hanging-punctuation">
                    在大数据时代，搜索引擎已经成为了众多应用系统不可或缺的一部分，无论是电子商务网站、社交平台，还是企业内部搜索，搜索引擎都在其中扮演着至关重要的角色。Lucene 和 Elasticsearch 是当前最流行的两种搜索引擎解决方案，它们各自在搜索领域拥有广泛的应用，但二者有着本质的差异。
                </p>
            </div>
        </div>
    </section>

    <!-- 概述部分 -->
    <section class="container mx-auto px-6 py-16">
        <h2 class="text-4xl font-bold text-center mb-16 gradient-text">技术概述</h2>
        
        <div class="grid md:grid-cols-2 gap-8 max-w-6xl mx-auto">
            <!-- Lucene 卡片 -->
            <div class="feature-card rounded-2xl p-8 card-hover">
                <div class="flex items-center mb-6">
                    <div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-blue-700 rounded-full flex items-center justify-center text-white text-2xl font-bold">
                        L
                    </div>
                    <h3 class="text-2xl font-bold ml-4 text-gray-800">Apache Lucene</h3>
                </div>
                <p class="text-gray-600 leading-relaxed mb-6">
                    Apache Lucene 是一个高性能、开源的信息检索库，它是一个<strong class="text-blue-600">全文搜索引擎</strong>，主要用于构建搜索引擎。Lucene 提供了丰富的功能，如索引创建、搜索查询、排名算法等。
                </p>
                <div class="space-y-3">
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">高性能单机搜索库</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">灵活的自定义能力</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">底层搜索引擎基础</span>
                    </div>
                </div>
            </div>

            <!-- Elasticsearch 卡片 -->
            <div class="feature-card rounded-2xl p-8 card-hover">
                <div class="flex items-center mb-6">
                    <div class="w-16 h-16 bg-gradient-to-br from-purple-500 to-pink-600 rounded-full flex items-center justify-center text-white text-2xl font-bold">
                        ES
                    </div>
                    <h3 class="text-2xl font-bold ml-4 text-gray-800">Elasticsearch</h3>
                </div>
                <p class="text-gray-600 leading-relaxed mb-6">
                    Elasticsearch 是基于 Lucene 的分布式搜索引擎，提供了更高层次的抽象和强大的功能。它不仅具备 Lucene 的全文搜索能力，还引入了分布式计算、RESTful API、实时数据分析等功能。
                </p>
                <div class="space-y-3">
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">分布式搜索引擎</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">RESTful API 接口</span>
                    </div>
                    <div class="flex items-center">
                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                        <span class="text-gray-700">实时数据分析能力</span>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 架构对比 -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <h2 class="text-4xl font-bold text-center mb-16 gradient-text">架构设计对比</h2>
            
            <!-- 架构图表 -->
            <div class="max-w-6xl mx-auto mb-12">
                <div class="mermaid">
                    graph TB
                        subgraph "Lucene 架构"
                            A[Document] --> B[Field]
                            B --> C[Analyzer]
                            C --> D[Index]
                            D --> E[Query]
                            style A fill:#e0e7ff,stroke:#6366f1
                            style B fill:#e0e7ff,stroke:#6366f1
                            style C fill:#e0e7ff,stroke:#6366f1
                            style D fill:#e0e7ff,stroke:#6366f1
                            style E fill:#e0e7ff,stroke:#6366f1
                        end
                        
                        subgraph "Elasticsearch 架构"
                            F[Cluster] --> G[Node]
                            G --> H[Index]
                            H --> I[Shards]
                            I --> J[Replica]
                            style F fill:#fce7f3,stroke:#ec4899
                            style G fill:#fce7f3,stroke:#ec4899
                            style H fill:#fce7f3,stroke:#ec4899
                            style I fill:#fce7f3,stroke:#ec4899
                            style J fill:#fce7f3,stroke:#ec4899
                        end
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 max-w-6xl mx-auto">
                <!-- Lucene 架构详情 -->
                <div class="bg-white rounded-xl shadow-lg p-8">
                    <h3 class="text-2xl font-bold mb-6 text-blue-600">
                        <i class="fas fa-cube mr-2"></i>Lucene 单机架构
                    </h3>
                    <div class="space-y-4">
                        <div class="border-l-4 border-blue-500 pl-4">
                            <h4 class="font-semibold text-gray-800">Document</h4>
                            <p class="text-gray-600">Lucene 中的最基本单元，表示一条记录</p>
                        </div>
                        <div class="border-l-4 border-blue-500 pl-4">
                            <h4 class="font-semibold text-gray-800">Field</h4>
                            <p class="text-gray-600">Document 由若干个 Field 组成，Field 表示字段</p>
                        </div>
                        <div class="border-l-4 border-blue-500 pl-4">
                            <h4 class="font-semibold text-gray-800">Analyzer</h4>
                            <p class="text-gray-600">用于处理文本数据，如分词器、过滤器</p>
                        </div>
                        <div class="border-l-4 border-blue-500 pl-4">
                            <h4 class="font-semibold text-gray-800">Index</h4>
                            <p class="text-gray-600">使用倒排索引（Inverted Index）来加速搜索</p>
                        </div>
                    </div>
                </div>

                <!-- Elasticsearch 架构详情 -->
                <div class="bg-white rounded-xl shadow-lg p-8">
                    <h3 class="text-2xl font-bold mb-6 text-purple-600">
                        <i class="fas fa-network-wired mr-2"></i>Elasticsearch 分布式架构
                    </h3>
                    <div class="space